<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>05_条件渲染</title>
    <!-- 引入Vue -->
    <script src="../node_modules/vue/dist/vue.js"></script>
</head>

<body>
    <!-- 编写div元素 -->
    <div id="app">
        <!-- 变量或表达式赋值 -->
        <button @click="flag=!flag">切换</button>
        <div v-if="flag==true">这是用v-if渲染的元素</div>
        <div v-show="flag">这是用v-show渲染的元素</div>
    </div>
    <!-- 编写Vue实例 -->
    <script>
        const vm = new Vue({
            // VM
            el: '#app',
            data: {
                flag: true
            },
            methods: {
                // toggle() {
                //     this.flag = !this.flag
                // }
            }
        })
    </script>
</body>

</html>